package com.jeff.android.lab.util;

import android.content.Context;
import android.graphics.Bitmap;

import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
import com.jeff.utils.ImageUtil;

import java.security.MessageDigest;

/**
 * Created by wq on 2017/10/16.
 */

public class RoundCornerTransform extends BitmapTransformation {
    private int corner;

    public RoundCornerTransform() {
        this(10);
    }

    public RoundCornerTransform(int corner) {
        if (corner < 0) corner = 10;
        this.corner = corner;
    }

    @Override
    protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
        return ImageUtil.getRoundedCornerBitmap(toTransform, corner);
    }

    @Override
    public void updateDiskCacheKey(MessageDigest messageDigest) {

    }
}
